<?php
namespace app\api\logic;

use think\Model;
use think\Db;

class VerificationCode extends Model
{
    public function check_mobile_code($mobile = '')
    {
        $vcodeFind = $this->where('mobile', $mobile)->where('add_time', 'gt', date('Y-m-d H:i:s', time()+30*60-80))->find();
        if (isset($vcodeFind)) {
            return false;
        }

        $today_time = date_startend_time(time());
        $where = ['mobile' => $mobile, 'add_time' => array('between', [date('Y-m-d H:i:s', $today_time['start']), date('Y-m-d H:i:s', $today_time['end'])])];
        $vcodeCount = $this->where($where)->count();
        if ($vcodeCount >= 10) {
            return false;
        }
        return true;
    }





}